package com.kevin.service;


import com.kevin.util.HttpClientExample;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

/**
 * @author kevin
 * @version 1.0
 * @project life-tool
 * @description 送再保服务实现类
 * @date 2024/5/13 10:16:16
 */
@Service
public class ReinsServiceImpl {



    public Map<Integer, String> batchAutoPrpallIn(String[] businessno) {

        Map<Integer, String> successMap = new HashMap<>();
        String[] requestBody1 = new String[1];
        String path = "/policycenter/controller/insurance/newreinsurance/batchAutoPrpallInfoList";
        String url = "http://9.0.9.11";
        url = url + path;


        //遍历这个数组
        for (String requestBodyItem : businessno) {
            System.out.println(requestBodyItem);
            requestBody1[0] = requestBodyItem;
            try {

                String response = HttpClientExample.sendPostRequest(url, Arrays.toString(requestBody1));
                System.out.println(Arrays.toString(requestBody1));




                System.out.println("Response: " + response);
            } catch (IOException e) {
                e.printStackTrace();
                successMap.put(201, "erro");
                return successMap;
            }
            //增加一个睡眠时间
//            try {
//                Thread.sleep(120000);
//            } catch (InterruptedException e) {
//                throw new RuntimeException(e);
//            }

        }

       successMap.put(200, "success");
        return successMap;
    }
}
